T_IMPORT ➔ ... ➔ ???   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
dl 0
loc 1
rs 10
c 1
b 0
f 0
nop 1
1
import { snakeCase } from 'lodash'
2
3
const apiHandler = {
4
  get: (target, prop, receiver) => {
0 ignored issues
show
Unused Code introduced by
The parameter receiver is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
5
    if (prop in target) {
6
      return target[prop]
7
    }
8
9
    const { client, api } = target
10
    return params => client.send(api, snakeCase(prop), params)
11
  },
12
  ownKeys: target => {
13
    return Reflect.ownKeys(target)
14
  }
15
}
16
17
const factoryApiMethods = (client, api) => {
18
  return new Proxy({ client, api }, apiHandler)
19
}
20
21
export { factoryApiMethods }
22